import { Type } from "class-transformer";
import { IsNumber, IsString } from "class-validator";
import { BaseEntity } from "src/common/entities/base.entity";
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity()
export class TUser extends BaseEntity {
  @PrimaryGeneratedColumn({
    name: "t_user_id",
    comment: "用户id",
    type: "int",
  })
  @Type()
  @IsNumber()
  t_user_id: number;

  @Column({
    name: "t_user_name",
    comment: "用户姓名",
    length: 100,
  })
  @IsString()
  t_user_name: string;

  @Column({
    name: "t_gender",
    comment: "性别",
  })
  @Type()
  @IsString()
  t_gender: string;

  @Column({
    name: "t_age",
    comment: "年龄",
    type: "int",
  })
  @Type()
  @IsNumber()
  t_age: number;

  @Column({
    name: "t_idCard",
    comment: "身份证号",
    length: 200,
  })
  @IsString()
  t_idCard: string;

  @Column({
    name: "t_status",
    comment: "用户状态",
    type: "int",
    default: 0,
  })
  t_status: number;
}
